package com.iqraaonline.userss.new_userss

import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import android.content.IntentFilter
import android.os.BatteryManager
import android.os.Build
import android.util.Log
import instant.news7.MainActivity
import io.flutter.embedding.android.FlutterActivity
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel


class JumpChannel(flutterEngine: BinaryMessenger, activity: FlutterActivity): MethodChannel.MethodCallHandler {
    private val batteryChannelName = "com.iqraaonline.userss.new_userss"
    private var channel: MethodChannel
    private var mActivity: FlutterActivity

    init {
        channel = MethodChannel(flutterEngine, batteryChannelName)
        channel.setMethodCallHandler(this)
        mActivity = activity;
    }

    override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
        if (call.method == "jumpToAndroidPage") {
            var  intent = Intent(mActivity,MainActivity::class.java)
            mActivity.startActivity(intent)
            mActivity.finish()

            result.success("");
        }
    }

}